package drds.global_transaction.transaction_coordinator.transaction_session;

import drds.global_transaction.api.api.BranchTransactionStatus;
import drds.global_transaction.api.api.GlobalTransactionStatus;
import drds.global_transaction.api.exception.GlobalTransactionException;

import java.util.Collection;
import java.util.List;

public interface TransactionSessionManager extends TransactionSessionLifecycleListener
{

	//
	void addBranchTransactionSession(GlobalTransactionSession globalTransactionSession, BranchTransactionSession branchTransactionSession) throws GlobalTransactionException;

	void addGlobalTransactionSession(GlobalTransactionSession globalTransactionSession) throws GlobalTransactionException;

	GlobalTransactionSession getGlobalTransactionSession(Long globalTransactionId) throws GlobalTransactionException;

	Collection<GlobalTransactionSession> getGlobalTransactionSessionList();

	List<GlobalTransactionSession> getGlobalTransactionSessionList(TransactionSessionCondition transactionSessionCondition);

	void removeBranchTransactionSession(GlobalTransactionSession globalTransactionSession, BranchTransactionSession branchTransactionSession) throws GlobalTransactionException;

	void removeGlobalTransactionSession(GlobalTransactionSession globalTransactionSession) throws GlobalTransactionException;

	void updateBranchTransactionSessionStatus(BranchTransactionSession branchTransactionSession, BranchTransactionStatus branchTransactionStatus) throws GlobalTransactionException;

	void updateGlobalTransactionSessionStatus(GlobalTransactionSession globalTransactionSession, GlobalTransactionStatus globalTransactionStatus) throws GlobalTransactionException;

}
